New convenience API to construct simple text combos, implemented by Damon
authorMatthias Clasen <maclas@gmx.de>
Thu, 26 Feb 2004 21:40:09 +0000 (21:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 26 Feb 2004 21:40:09 +0000 (21:40 +0000)
Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkcomboboxentry.h:
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
convenience API to construct simple text combos, implemented by
Damon Chaplin.

* tests/testcombo.c: Use gtk_combo_box_entry_new_text.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/gtk/gtk-sections.txt
gtk/gtkcombobox.c
gtk/gtkcomboboxentry.c
gtk/gtkcomboboxentry.h
tests/testcombo.c

index e6d34c2a815921df53043027c3ecff90ea8b188e..7b3b32aa4e1ff53e1ed6aef9aa863b29a620a09c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcomboboxentry.h:
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
+       convenience API to construct simple text combos, implemented by
+       Damon Chaplin.
+
+       * tests/testcombo.c: Use gtk_combo_box_entry_new_text.
+
+Thu Feb 26 22:19:29 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
+
 Thu Feb 26 15:43:43 2004  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality
index e6d34c2a815921df53043027c3ecff90ea8b188e..7b3b32aa4e1ff53e1ed6aef9aa863b29a620a09c 100644 (file)
@@ -1,3 +1,16 @@
+Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcomboboxentry.h:
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
+       convenience API to construct simple text combos, implemented by
+       Damon Chaplin.
+
+       * tests/testcombo.c: Use gtk_combo_box_entry_new_text.
+
+Thu Feb 26 22:19:29 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
+
 Thu Feb 26 15:43:43 2004  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality
index e6d34c2a815921df53043027c3ecff90ea8b188e..7b3b32aa4e1ff53e1ed6aef9aa863b29a620a09c 100644 (file)
@@ -1,3 +1,16 @@
+Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcomboboxentry.h:
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
+       convenience API to construct simple text combos, implemented by
+       Damon Chaplin.
+
+       * tests/testcombo.c: Use gtk_combo_box_entry_new_text.
+
+Thu Feb 26 22:19:29 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
+
 Thu Feb 26 15:43:43 2004  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality
index e6d34c2a815921df53043027c3ecff90ea8b188e..7b3b32aa4e1ff53e1ed6aef9aa863b29a620a09c 100644 (file)
@@ -1,3 +1,16 @@
+Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcomboboxentry.h:
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
+       convenience API to construct simple text combos, implemented by
+       Damon Chaplin.
+
+       * tests/testcombo.c: Use gtk_combo_box_entry_new_text.
+
+Thu Feb 26 22:19:29 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
+
 Thu Feb 26 15:43:43 2004  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality
index e6d34c2a815921df53043027c3ecff90ea8b188e..7b3b32aa4e1ff53e1ed6aef9aa863b29a620a09c 100644 (file)
@@ -1,3 +1,16 @@
+Thu Feb 26 22:20:44 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcomboboxentry.h:
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New
+       convenience API to construct simple text combos, implemented by
+       Damon Chaplin.
+
+       * tests/testcombo.c: Use gtk_combo_box_entry_new_text.
+
+Thu Feb 26 22:19:29 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_new_text): Improve the docs.
+
 Thu Feb 26 15:43:43 2004  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkstyle.[ch]: Export insertion cursor drawing functionality
index f1dcc7386de1cd8b8fbba4ff3362d35f2e20ce59..a38ac95561b358991e833b3a64f925150aa66690 100644 (file)
@@ -1,3 +1,7 @@
+Thu Feb 26 22:18:21 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtk-sections.txt: Add gtk_combo_box_entry_new_text.
+
 Thu Feb 26 21:41:25 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtk-sections.txt: Add gtk_rc_reset_styles.
index 05265feef6debfd9ffa6c8d3faa7a614f5b1b3c5..4f30665c2ad7c6aaaec1bc7b445cba47fd1ab5e7 100644 (file)
@@ -705,6 +705,7 @@ gtk_combo_box_get_type
 GtkComboBoxEntry
 gtk_combo_box_entry_new
 gtk_combo_box_entry_new_with_model
+gtk_combo_box_entry_new_text
 gtk_combo_box_entry_set_text_column
 gtk_combo_box_entry_get_text_column
 <SUBSECTION Standard>
index 1ae57c59b75d911fc752e18225975b3769ede9da..f02031ad81202fb8ccca2c94683bdd0c480fdf24 100644 (file)
@@ -2842,9 +2842,10 @@ gtk_combo_box_get_model (GtkComboBox *combo_box)
  *
  * Convenience function which constructs a new text combo box, which is a
  * #GtkComboBox just displaying strings. If you use this function to create
- * a text combo box, you only want to manipulate it's data source with the
+ * a text combo box, you should only manipulate its data source with the
  * following convenience functions: gtk_combo_box_append_text(),
- * gtk_combo_box_insert_text() and gtk_combo_box_prepend_text().
+ * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
+ * gtk_combo_box_remove_text().
  *
  * Return value: A new text combo box.
  *
index a21e73f82375331f224b74da24062ec663609265..25625f5125b805fbe3644f25c97fa123d1cd8286 100644 (file)
@@ -337,3 +337,33 @@ gtk_combo_box_entry_mnemonic_activate (GtkWidget *widget,
 
   return TRUE;
 }
+
+
+/* convenience API for simple text combos */
+
+/**
+ * gtk_combo_box_entry_new_text:
+ *
+ * Convenience function which constructs a new editable text combo box, which 
+ * is a #GtkComboBoxEntry just displaying strings. If you use this function to
+ * create a text combo box, you should only manipulate its data source with
+ * the following convenience functions: gtk_combo_box_append_text(),
+ * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
+ * gtk_combo_box_remove_text().
+ *
+ * Return value: A new text #GtkComboBoxEntry.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gtk_combo_box_entry_new_text (void)
+{
+  GtkWidget *entry_box;
+  GtkListStore *store;
+
+  store = gtk_list_store_new (1, G_TYPE_STRING);
+
+  entry_box = gtk_combo_box_entry_new_with_model (GTK_TREE_MODEL (store), 0);
+
+  return entry_box;
+}
index 9b120427a28c33a7eae5fa580f16d6bce5bb136e..8955426b9e3b38919bab990ff5db73ee9b5cb9ff 100644 (file)
@@ -65,6 +65,9 @@ void        gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
                                                  gint              text_column);
 gint        gtk_combo_box_entry_get_text_column (GtkComboBoxEntry *entry_box);
 
+/* convenience -- text */
+GtkWidget  *gtk_combo_box_entry_new_text        (void);
+
 
 G_END_DECLS
 
index 485fe1f3f2d20dfd05b1442a54aa571c354bd675..f5a02c454389db10fdcb5510d8f72dca11c634ca 100644 (file)
@@ -165,33 +165,21 @@ create_blaat ()
         return GTK_TREE_MODEL (store);
 }
 
-static GtkTreeModel *
-create_text_store ()
+static void
+setup_combo_entry (GtkWidget *entry_box)
 {
-        GtkTreeIter iter;
-        GtkListStore *store;
-
-        store = GTK_LIST_STORE (gtk_list_store_new (1, G_TYPE_STRING));
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, "dum de dum", -1);
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, "la la la", -1);
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, "la la la dum de dum la la la la la la boom de da la la", -1);
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, "bloop", -1);
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, "bleep", -1);
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, "klaas", -1);
-
-        return GTK_TREE_MODEL (store);
+       gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+                                  "dum de dum");
+       gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+                                  "la la la");
+       gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+                                  "la la la dum de dum la la la la la la boom de da la la");
+       gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+                                  "bloop");
+       gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+                                  "bleep");
+       gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+                                  "klaas");
 }
 
 int
@@ -302,7 +290,8 @@ main (int argc, char **argv)
         gtk_container_set_border_width (GTK_CONTAINER (boom), 5);
         gtk_container_add (GTK_CONTAINER (tmp), boom);
 
-        comboboxtext = gtk_combo_box_entry_new_with_model (create_text_store (), 0);
+        comboboxtext = gtk_combo_box_entry_new_text ();
+       setup_combo_entry (comboboxtext);
         gtk_container_add (GTK_CONTAINER (boom), comboboxtext);
 
         /* done */